﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace BackupRestoreApplication
{
    class _7zDll
    {
        public static string pathroaming = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData).ToString();
        public static string pathlocal = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData).ToString();
        public static string pathdata = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData).ToString();

        public static void Compress(string source, string target)
        {
            ProcessStartInfo p = new ProcessStartInfo();
            p.FileName = @"7za.exe";
            p.Arguments = "a -t7z \"" + target + "\" \"" + source + "\" -mx=9";
            //               1              2                       3               4
            p.WindowStyle = ProcessWindowStyle.Hidden;
            Process x = Process.Start(p);
            x.WaitForExit();
        }

        public static void ExtractFile(string source, string dest)
        {
                ProcessStartInfo pro = new ProcessStartInfo();
                pro.FileName = @"7za.exe";
                pro.Arguments = "x \"" + source + "\" -o\"" + dest + "\" -y";
                pro.WindowStyle = ProcessWindowStyle.Hidden;
                Process x = Process.Start(pro);
                x.WaitForExit();
        }

        public static void Regimport(string source)
        {
            ProcessStartInfo p = new ProcessStartInfo();
            p.FileName = @"REGEDIT.EXE";
            p.Arguments = "/S \"" + source;
            //               1              2                       3               4
            p.WindowStyle = ProcessWindowStyle.Normal;
            Process x = Process.Start(p);
            x.WaitForExit();
        }

        public static void Regexport(string keyreg, string pathreg)
        {
            ProcessStartInfo p = new ProcessStartInfo();
            p.FileName = @"REG.EXE";
            p.Arguments = "EXPORT \"" + keyreg + "\" \"" + pathreg + "\"";
            //               1              2                       3               4
            p.WindowStyle = ProcessWindowStyle.Hidden;
            Process x = Process.Start(p);
            x.WaitForExit();
        }

        public static void Delete()
        {
            ProcessStartInfo prod = new ProcessStartInfo();
            prod.FileName = @"CCleaner\CCleaner.exe";
            prod.Arguments = " /AUTO";
            prod.WindowStyle = ProcessWindowStyle.Hidden;
            Process x = Process.Start(prod);
            x.WaitForExit();
        }
    }
}
